package gmusic.mb.bo;

import gmusic.bo.ReleaseBean;
import gmusic.services.impl.GMusicServicesImpl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ReleaseMBBean extends ReleaseBean {

	protected String mbid = null;

	protected String typeMB = null;

	protected String artistMbid = null;

	private List<TrackMBBean> tracksMB = new ArrayList<TrackMBBean>();

	public ReleaseMBBean() {

	}

	public ReleaseMBBean(ResultSet rs) throws SQLException {
		setMbid(rs.getString("mbid"));
		setNom(rs.getString("nom"));
		setArtistMbid(rs.getString("artist_mbid"));
		setAnnee(rs.getInt("annee"));
		setTypeId(rs.getInt("type_id"));
	}

	public List<TrackMBBean> getTracksMB() {
		return tracksMB;
	}

	public void setTracksMB(List<TrackMBBean> tracks) {
		this.tracksMB = tracks;
	}

	public void addTrack(TrackMBBean mt) {
		tracksMB.add(mt);
	}

	public String getMbid() {
		return mbid;
	}

	public void setMbid(String mbid) {
		this.mbid = mbid;
	}

	public String toString() {
		return "[mbid=" + mbid + ";nom=" + nom + ";type=" + typeMB + ";annee="
				+ annee + "]";
	}

	public String getTypeMB() {
		return typeMB;
	}

	public void setTypeMB(String typeMB) {
		this.typeMB = typeMB;
	}

	public String getArtistMbid() {
		return artistMbid;
	}

	public void setArtistMbid(String artistMbid) {
		this.artistMbid = artistMbid;
	}

	public boolean existsInGM() throws SQLException {
		return GMusicServicesImpl.getInstance().releaseMBExists(mbid);
	}
}
